﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace SimpleSocxs
{
    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void OnLogin(object sender, EventArgs e)
        {
            var username = txtUsername.Text;
            var socxs_user = SocxsDataStore.Current.GetUserByName(username);
            if (socxs_user == null)
            {
                socxs_user = new User { Name = username };
                SocxsDataStore.Current.AddUser(socxs_user);
            }                

            FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, chbRemeber.Checked);
        }
    }
}